//
//  FirstCellTableViewCell.m
//  EasyToTesco2.0
//
//  Created by 袖手旁觀 on 16/6/21.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "FirstCellTableViewCell.h"

#define Margin 8

@implementation FirstCellTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self loadFirstCell];
    }
    return self;
}

- (void)loadFirstCell {
    UILabel *firstLabel = [[UILabel alloc] init];
    firstLabel.font = [UIFont systemFontOfSize:15];
    firstLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(15.0)];
    firstLabel.textAlignment = NSTextAlignmentLeft;
    self.firstLabel = firstLabel;
    [self.contentView addSubview:firstLabel];
    
    UITextField *inPutTextField = [[UITextField alloc] init];
    inPutTextField.borderStyle = UITextBorderStyleNone;
    inPutTextField.font = [UIFont systemFontOfSize:15];
    inPutTextField.clearButtonMode = UITextFieldViewModeAlways;
    self.inPutTextField = inPutTextField;
    [self.contentView addSubview:inPutTextField];
    
    [firstLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.contentView.mas_left).with.offset(Margin * 2);
        make.height.mas_equalTo(self.contentView.mas_height);
        make.width.mas_equalTo(WIDTH * 0.3);
    }];
    
    [inPutTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(firstLabel.mas_right).with.offset(Margin);
        make.width.mas_equalTo(WIDTH * 0.6);
        make.height.mas_equalTo(self.contentView.mas_height);
    }];
    
    UILabel *rightLabel = [[UILabel alloc] init];
    rightLabel.hidden = YES;
    rightLabel.text = @"0.00";
    rightLabel.textColor = [UIColor lightGrayColor];
    rightLabel.textAlignment = NSTextAlignmentLeft;
    rightLabel.font = [UIFont systemFontOfSize:15];
    rightLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(15.0)];
    self.rightLabel = rightLabel;
    [self.contentView addSubview:rightLabel];
    
    [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(firstLabel.mas_right).with.offset(Margin);
        make.width.mas_equalTo(WIDTH * 0.6);
        make.height.mas_equalTo(self.contentView.mas_height);
    }];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
